package com.rogue.generator.controller;

import com.rogue.generator.service.GeneratorService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@Api(tags = {"生成器"})
@RestController
@RequestMapping(value = "")
public class GeneratorController {

    @Autowired
    private GeneratorService generatorService;

    @ApiOperation(value = "获取下一个ID")
    @RequestMapping(value = "/nextId", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public long nextId() throws Exception {
        return generatorService.nextId();
    }
}
